<template>

<van-icon name="arrow-left" @click="tohome()" />
  <center>

    <van-field
        v-model="fieldValue"
        is-link
        readonly
        label="客服"
        @click="tokefu"
    />
    <van-button type="danger" @click="tui">退出登录</van-button>
  </center>
</template>
<script setup>
import http from "@/http";
import {showConfirmDialog, showSuccessToast} from "vant";
import {ref,onMounted} from "vue";
import router from "@/router";


const fieldValue = ref('');



const tokefu=()=>{
  router.push('/kefu')
}

const tohome = () => {
  router.push('/')
}

const tui = () => {
  showConfirmDialog({
    title: '',
    message:
        '退出登录',
  })
      .then(() => {
        // on confirm
        http.post(`user/quit/`).then(res => {
          if (res.data.code == 200) {
            showSuccessToast(res.data.msg)
            localStorage.removeItem("userid")
            localStorage.removeItem("token")
            localStorage.removeItem("retoken")
          }
        })
      })
      .catch(() => {
        // on cancel
      });
}
onMounted(()=>{

})
</script>

